home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / libdump / ole.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-24  |  3.3 KB  |  73 lines

  1. /*  ole.h  --  global include for the Object Library Engine  */
  2.  
  3. #define THEADR               0x80          /* OMF module header */
  4. #define COMENT               0x88          /* OMF comment record */
  5. #define MODEND               0x8a          /* OMF module end record */
  6. #define LIBMOD               0xa3          /* library module name commet class */
  7. #define LIBHEADER            0xf0          /* LIB file header */
  8. #define MARKER_RECORD        0xf1          /* marker between modules and dictionary */
  9. #define NUMBUCKETS           37            /* number of buckets per block */
  10. #define DICTBLOCKSIZE        512           /* bytes per symbol dictionary block */
  11. #define DICTBLKFULL          0xff          /* symbol dictionary block full */
  12.  
  13. #define UNDEFINED            -1            /* to indicate non-initialised data */
  14. #define STR_EQUAL            0             /* string equality */
  15.  
  16. /* these two macros will rotate the word operand opw by nbits bits (0 - 16) */
  17. #define WORDBITS             16
  18. #define ROL(opw, nbits)      (((opw) << (nbits)) | ((opw) >> (WORDBITS - (nbits))))
  19. #define ROR(opw, nbits)      (((opw) >> (nbits)) | ((opw) << (WORDBITS - (nbits))))
  20.  
  21. typedef enum { FALSE, TRUE } BOOL;
  22.  
  23. #pragma pack(1)
  24.  
  25. typedef struct {
  26.                  unsigned char rectype;
  27.                  int reclength;
  28.                } OMFHEADER;
  29.  
  30. typedef struct {
  31.                  unsigned char rectype;
  32.                  int reclength;
  33.                  unsigned char attrib;
  34.                  unsigned char commentclass;
  35.                } COMMENTHEADER;
  36.  
  37. typedef struct {                           /* record type 0xf0 */
  38.                  int pagesize;              /* header length (excluding first 3 bytes
  39.                                               == page size (module at page boundary) */
  40.                  long dictionaryoffset;    /* file offset of symbol dictionary */
  41.                  int numdictblocks;        /* number of symbol dictionary blocks
  42.                                               <= 251 512-byte dictionary pages */
  43.                  unsigned char flags;      /* only valid flag is 0x01 == case-sensitive */
  44.                  BOOL iscasesensitive;
  45.                  BOOL islibmodformat;      /* is MS extension type LIBMOD present ? */
  46.                } LIBHDR;
  47.  
  48. typedef struct {
  49.                  int blocknumber;
  50.                  int bucketnumber;
  51.                  unsigned char *symbolp;
  52.                  long modulefilepos;
  53.                  BOOL isfound;
  54.                } DICTENTRY;
  55.  
  56. typedef struct {
  57.                  int blockhash;
  58.                  int blockovfl;
  59.                  int buckethash;
  60.                  int bucketovfl;
  61.                }  hasht;
  62.  
  63. void getlibheader(LIBHDR *libheader, FILE *inlibfh);
  64. hasht hash(char symbolz[], int numhashblocks);
  65. DICTENTRY findsymbol(char *symbolz, LIBHDR *libheader, FILE *inlibfh);
  66. void getsymdictblock(int blocknumber, LIBHDR *libheader, FILE *inlibfh);
  67. long findmodule(char *modulename, LIBHDR *libheader, FILE *inlibfh);
  68. DICTENTRY getsymdictentry(int blocknumber, int bucketnumber, LIBHDR *libheader, FILE *inlibfh);
  69. char *getmodulename(long modulefilepos, LIBHDR *libheader, FILE *inlibfh);
  70. BOOL findlibmod(FILE *inlibfh);
  71. BOOL findobjrecord(FILE *objfh, unsigned char rectype);
  72. BOOL extractmodule(char *modulename, char *newmodulename, LIBHDR *libheader, FILE *inlibfh);
  73. void copyobjmodule(FILE *newobjfh, long filepos, FILE *inlibfh);